package com.jinlejia.erp.ui.new_house.house;

import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;

import com.freedom.yefeng.yfrecyclerview.FullyLinearLayoutManager;
import com.freedom.yefeng.yfrecyclerview.YfListRecyclerView;
import com.jinlejia.erp.R;
import com.jinlejia.erp.ui.new_house.adapter.AddRecommendAdapter;
import com.jinlejia.erp.utils.SerializableObject;

import java.util.ArrayList;
import java.util.Map;

/**
 * 加推信息
 */
public class AddtionListActivity extends AppCompatActivity {

    AddRecommendAdapter adapter;
    private YfListRecyclerView recyclerView;
    private ArrayList<Map<String,Object>> datalist = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_addtion_list);

        SerializableObject map =(SerializableObject) getIntent().getSerializableExtra("addtionList");
        if( null != map )
        datalist =(ArrayList<Map<String,Object>>) map.getObject();
        initView();
    }
    private void initView(){
        ImageView back = (ImageView) findViewById(R.id.id_back);
        recyclerView = (YfListRecyclerView) findViewById(R.id.id_addtion_list);
        recyclerView.setLayoutManager(new FullyLinearLayoutManager(this));
        recyclerView.setHasFixedSize(true);
//        ArrayList<String> arrayList = getIntent().getStringArrayListExtra("addtionList");
        adapter = new AddRecommendAdapter(datalist);
        recyclerView.setAdapter(adapter);

        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
        datalist.clear();
    }
}
